<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
        <meta name="format-detection" content="telephone=no" />
        <title>全部商品</title>
        <link rel="stylesheet" type="text/css" href="../css/aui.css" />
        <link rel="stylesheet" type="text/css" href="../css/aui-flex.css" />
        <style type="text/css">
            .list-content{
                padding:10px 0;
            }
            .dongtai ul{
                overflow-y: hidden;
            }
            .dongtai .aui-tab-nav li.active{
                color: #327afa;
                border-bottom: 2px #327afa solid;
            }
            .dongtai .divHeader{
                width:40%;
                margin:0 auto;
            }
            .dongtai ul{
                background: #f3f3f3;
            }
            .dongtai .aui-list-view .aui-img-object{
                max-width: 40px;
                height: 40px;
            }
            .dongtai .aui-list-view .aui-img-object.aui-pull-left{
                margin-right: 10px;
            }
            .dongtai .aui-list-view-cell{
                margin-bottom: 15px;
                background: #fff;
                margin-top: 8px;
            }
            .dongtai .aui-img-body{
                float: left;
                max-width: 195px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .dongtai .remenType ul{
                background: #fff;
            }
            .dongtai .aui-list-view:after{
                border:none;
            }
            .dongtai .type{
                font-size: 12px;
                background: #feb77e;
                color:#fff;
                padding: 2px 5px;
            }
            .dongtai .title{
                width: 100%;
                display: inline-block;
                margin: 6px;
            }
            .dongtai .conttent img{
                width: 31%;
                margin-left:2%;
                float: left;
                margin-top: 8px;
            }
            .type2{
                font-size: 12px;
                color:#fff;
                padding: 2px 5px;
                background: #78D98E;
            }

            /** 商品动态**/
            .act-title{
                width: 100%;
                display: inline-block;
                margin: 6px;
                word-wrap:break-word;
            }
            .img-item {
                background-color: #eee;
                background-size: cover;
                height:135px;
                margin-right:2%;
                margin-top: 3px;
                float: left;
            }
            .img-item.type1{
                width:82%;
            }
            .img-item.type2{
                width:41%;
            }
            .img-item.type3{
                width:31%;
            }

            .iConent:before {
                content: "\e700" !important;
            }
        </style>
    </head>
    <body>
         <div class="aui-content dongtai">
            <ul class="aui-list-view" id="list-content" style="display: none !important;">
            </ul>
        </div>
    </body>
    <script id="list-template" type="text/x-dot-template">
        {{ for(var i in it){ }}
        <li class="aui-list-view-cell aui-img" item-id="{{=it[i].itemid}}" onclick="go2Pro({{=it[i].itemid}},'../')">
            <div class="aui-img-body">
                <p class="post_detail">
                    <span class="time">{{=formatMsgTime(it[i].addtime)}}</span>
                    <!-- <span class="time">2016-12-1</span> -->
                    &nbsp;&nbsp;浏览<span class="sum">{{=it[i].hits}}</span>
                </p>
            </div>
            <!-- <div class="shoucang aui-pull-right {{? it[i].isCollect == 1}}collected{{?}}">
                <span class="type">{{? it[i].isCollect == 1}}已{{?}}收藏</span>
            </div> -->
            <div class="act-title">{{=it[i].title}}</div>
            {{? it[i].thumb }}
            <div class="conttent aui-clearfix">
                {{? it[i].thumb&&!it[i].thumb1 }}
                <div class="img-item type1" style="background-image: url({{=it[i].thumb}});"></div>
                {{?? it[i].thumb&&it[i].thumb1&&!it[i].thumb2}}
                <div class="img-item type2" style="background-image: url({{=it[i].thumb}});"></div>
                <div class="img-item type2" style="background-image: url({{=it[i].thumb1}});"></div>
                {{??}} 
                <div class="img-item type3" style="background-image: url({{=it[i].thumb}});"></div>
                <div class="img-item type3" style="background-image: url({{=it[i].thumb1}});"></div>
                <div class="img-item type3" style="background-image: url({{=it[i].thumb2}});"></div>
                {{?}}
            </div>
            {{?}}
        </li>

        {{ } }}
    </script>
    <script type="text/javascript" src="../script/api.js" ></script>
    <script type="text/javascript" src="../script/common.js"></script>
    <script type="text/javascript" src="../script/doT.min.js"></script>
    <script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
    <script type="text/javascript">
        var isLock=false,myUid;
        var targetUsername;
        var page=1;
        apiready = function() {
            targetUsername=api.pageParam.targetUsername;

            api.parseTapmode();
            api.setRefreshHeaderInfo({
                visible : true,
                loadingImg : 'widget://image/ptr_pull.png',
                bgColor : '#efeff4',
                textColor : '#959595',
                textDown : '下拉刷新',
                textUp : '松开刷新',
                showTime : true
            }, function(ret, err) {
                page = 1;
                isLock=false;
                loadData();
            });

            // 监听是否达到底部上拉加载
            api.addEventListener({
                name : 'scrolltobottom'
            }, function(ret, err) {
                page++;
                if (!isLock)loadData(page);
            });

            api.refreshHeaderLoading();
        }

        function loadData(toPage){
            toPage=toPage?toPage:page;

            if(toPage==1)api.refreshHeaderLoading();

            getStorageAll();
            var url = 'Factory/storeDynamics';
            var data = {
                page:toPage,
                userName:targetUsername
            };
            myUid=user_id;
            if(!isLock){
                isLock = true;
                ajaxRequest(url, 'post', data, function (ret, err) {
                    isLock=false;
                    api.refreshHeaderLoadDone();            
                    if (ret.status == 1) {
                       var tpl = $api.byId('list-template').text;
                        var tempFn = doT.template(tpl);

                        if (toPage > 1) {
                            if(!$.trim(ret.msg)){
                                isLock=true;
                                return;
                            }
                            $('#list-content').show().append(tempFn(ret.msg));
                        }else{
                            $('#list-content').show().html(tempFn(ret.msg));
                        }
                    } else {
                        api.toast({
                            msg: ret.msg,
                            duration: 2000,
                            location: 'bottom'
                        });
                        isLock=true;
                    }
                });
            }
        }
    </script>
</html>